<template>
  <div>
    <el-dialog
      title="详情"
      :visible.sync="isShowModel"
      :before-close="handleClose"
      width="600px"
    >
      <el-form ref="form" :model="param" label-width="80px">
        <el-form-item label="标题名称" prop="title">
          {{ param.title }}
        </el-form-item>
        <el-form-item label="内容" prop="content">
          {{ param.content }}
          <!-- <el-input v-model="param.content" type="textarea" :rows="4" :autosize="{ minRows: 5, maxRows: 5 }" disabled /> -->
        </el-form-item>
        <el-form-item label="消息类型" prop="msgTypeId">
          {{ param.msgTypeId == 1?'商户消息':param.msgTypeId == 2?'场馆消息':'小程序消息' }}
          <!-- <el-select v-model="param.msgTypeId" disabled @change="changeType">
            <el-option label="商户消息" value="1" />
            <el-option label="场馆消息" value="2" />
            <el-option label="小程序消息" value="3" />
          </el-select> -->
        </el-form-item>
        <el-form-item v-if="param.msgTypeId == '1' || param.msgTypeId == '2'" label="通知商户" prop="shopIds">
          {{ param.shopIdsName || '' }}
          <!-- <el-select v-model="param.shopIds" filterable multiple disabled @change="changeShop">
            <el-option v-for="item,i in shops" :key="i" :label="item.shopName" :value="item.shopId" />
          </el-select> -->
        </el-form-item>
        <el-form-item v-if="param.msgTypeId == '2'" label="通知场馆" prop="recipients">
          {{ param.recipientsName || '' }}
          <!-- <el-checkbox-group v-model="param.recipients" disabled>
            <el-checkbox v-for="item,i in venues" :key="i" :label="item.id">{{ item.name }}</el-checkbox>
          </el-checkbox-group> -->
        </el-form-item>
        <el-form-item v-if="(param.msgTypeId == '1' || param.msgTypeId == '2') && param.filePathFull" label="附件">
          <a :href="param.filePathFull"><el-button type="primary">查看附件</el-button></a>
        </el-form-item>
      </el-form>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
      </span> -->
    </el-dialog>
  </div>
</template>

<script>
import { MessageDetail } from '@/api'
export default {
  data() {
    return {
      param: {
        shopIds: [],
        recipients: []
      },
      isShowModel: false
    }
  },
  methods: {
    getDetail(id) {
      MessageDetail({ param: { id }}).then(res => {
        const obj = { ...res.record }
        if (obj.shopIds) {
          obj.shopIds = obj.shopIds.split(',')
        } else {
          obj.shopIds = []
        }
        if (obj.recipients) {
          obj.recipients = obj.recipients.split(',')
        } else {
          obj.recipients = []
        }
        this.param = { ...obj }
      })
    },
    handleClose() {
      this.isShowModel = false
      this.$emit('close')
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
